<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

namespace Database\Seeders;

use App\Enums\CheckStatusEnum;
use App\Models\House;
use App\Models\User;
use App\Models\UserProfile;
use Illuminate\Database\Seeder;

class HouseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run()
    {
        for ($i = 0; $i < 10; ++$i) {
            $user = User::factory()->create([
                'identity' => rand(2, 3),
                'name' => 'name_' . $i,
            ]);
            UserProfile::factory()->create([
                'user_id' => $user->id,
                'name' => $user->name,
                'identity' => $user->identity,
                'check_status' => CheckStatusEnum::CHECK_ADOPT,
                'houser_score' => rand(1, 5),
            ]);
            for ($j = 0; $j < 2; ++$j) {
                House::factory()->create([
                    'houser_user_id' => $user->id,
                    'check_status' => rand(1, 3),
                ]);
            }
        }
    }
}
